package TemplateCode;

public class SubjectProxy extends Subject{
    private Subject subjectReal;

    public SubjectProxy(Subject subjectReal) {
        this.subjectReal = subjectReal;
    }

    @Override
    public boolean request() {
        preRequest();
        subjectReal.request();
        postRequest();
        return true;
    }

    public boolean preRequest(){
        System.out.println("预处理完成");
        return true;
    }

    public boolean postRequest(){
        System.out.println("后处理完成");
        return true;
    }

}
